package main

import "fmt"

func main() {
// if语句
	age := 1
	if age < 18{
		fmt.Println("kid")
	}else{
		fmt.Println("adult")
	}

	//fmt.Println("vim-go")
	
// switch语句
	type Gender int8
	//标识符全部大写
	const(
		MALE Gender = 1
		FEMALE Gender = 2
		UNKNOW Gender = 3
	)

	gender := MALE
	
	//将下面的case语句值 =》匹配gender
	//找到匹配项后会自动break，如需继续执行可以添加fallthrough关键字
	switch gender{
		case FEMALE:
			fmt.Println("female")
			fallthrough
		case MALE:
			fmt.Println("male")
			fallthrough
		default:
			fmt.Println("unknow")
	}

// for语句
	//无限循环
	//for {
	// for true {
	//	fmt.Println("这是一个无限循环")
	//}

	//常规使用,求1~10的和
	sum := 0
	for i:=0; i<10; i++{
		if sum > 50{
			break
		}
		sum += i
	}
	fmt.Println(sum)
}
